import React from "react";
import {
  DashboardOutlined,
  AppstoreOutlined,
  HomeOutlined,
} from "@ant-design/icons";

const iconMap = {
  HomeOutlined: <HomeOutlined />,
  Dashboard: <DashboardOutlined />,
  Assembly: <AppstoreOutlined />,
};

export const generateMenuItems = (menuList) => {
  return menuList.map((item) => {
    const icon = item.meta?.icon ? iconMap[item.meta.icon] : null;
    if (item.children && item.children.length > 0) {
      return {
        key: item.path,
        icon,
        label: item.meta?.title || item.name,
        children: generateMenuItems(item.children),
      };
    }
    return {
      key: item.path,
      icon,
      label: item.meta?.title || item.name,
    };
  });
};
